<template>
    <van-skeleton title :row="3" />

    <div>
        <div v-html="detaillist.goods_introduce"></div>
        <div v-for="(item, index) in detaillist.pics">{{ item.goods_big_logo }}</div>
        <van-submit-bar :price="(detaillist.goods_price) * 100" button-text="加入购物车" @submit="onSubmit">
            <van-button type="primary" to="/home/cart" size="small">购物车</van-button>
        </van-submit-bar>


    </div>
</template>

<script setup>
import { ref } from 'vue'
import axios from 'axios';
import { useRoute } from 'vue-router';
import { useRouter } from 'vue-router';
import { usecartStore } from '../store'
import { storeToRefs } from 'pinia';
const { cart_list } = usecartStore()
const route = useRoute()
const router = useRouter()
const detaillist = ref([])
axios('https://api-hmugo-web.itheima.net/api/public/v1/goods/detail', {
    params: {
        goods_id: route.query.goods_id
    }
}).then(res => {
    detaillist.value = res.data.message
})
const onSubmit = () => {
    cart_list({ ...detaillist.value, number: 1, check: true })

};
</script>

<style lang="scss" scoped></style>